import { PagedRequestDto } from "@shared/component-base";

export interface IChannelGroupDto {
  id:number;
  name:string;
  isShow:boolean;
  orderNo:string;
}

export class ChannelGroupDto implements IChannelGroupDto {
  id:number;
  name:string;
  isShow:boolean;
  orderNo:string;

  constructor(data?: IChannelGroupDto) {
    if (data) {
      for (var property in data) {
        if (data.hasOwnProperty(property))
          (<any>this)[property] = (<any>data)[property];
      }
    }
  }

  init(data?: any) {
    if (data) {
      this.id = data["id"];
      this.name = data["name"];
      this.isShow = data["isShow"];
      this.orderNo = data["orderNo"];
      
    }
  }

  static fromJS(data: any): ChannelGroupDto {
    data = typeof data === 'object' ? data : {};
    let result = new ChannelGroupDto();
    result.init(data);
    return result;
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
      data["id"]=this.id;
      data["name"]=this.name;
      data["isShow"]=this.isShow;
      data["orderNo"]=this.orderNo;

    return data;
  }

  clone() {
    const json = this.toJSON();
    let result = new ChannelGroupDto();
    result.init(json);
    return result;
  }
}

export class ChannelGroupListQueryDto extends PagedRequestDto {
  phone: string;
  keywords: string;

  init(data?: any) {
    if (data) {
      this.pageIndex = data["pageIndex"];
      this.pageSize = data["pageSize"];
      this.sortField = data["sortField"];
      this.sortOrder = data["sortOrder"];
      this.keywords = data["keywords"];
    }
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
    data["pageIndex"] = this.pageIndex;
    data["pageSize"] = this.pageSize;
    data["sortField"] = this.sortField;
    data["sortOrder"] = this.sortOrder;
    data["keywords"] = this.keywords;
    return data;
  }
}

export interface IChannelGroupEditDto {
  id:number;
  name:string;
  isShow:boolean;
  orderNo:string;
}

export class ChannelGroupEditDto implements IChannelGroupEditDto {
  id:number;
  name:string;
  isShow:boolean;
  orderNo:string;

  constructor(data?: IChannelGroupEditDto) {
    if (data) {
      for (var property in data) {
        if (data.hasOwnProperty(property))
          (<any>this)[property] = (<any>data)[property];
      }
    }
  }

  init(data?: any) {
    if (data) {
      this.id = data["id"];
      this.name = data["name"];
      this.isShow = data["isShow"];
      this.orderNo = data["orderNo"];
      
    }
  }

  static fromJS(data: any): ChannelGroupEditDto {
    data = typeof data === 'object' ? data : {};
    let result = new ChannelGroupEditDto();
    result.init(data);
    return result;
  }

  toJSON(data?: any) {
    data = typeof data === 'object' ? data : {};
      data["id"]=this.id;
      data["name"]=this.name;
      data["isShow"]=this.isShow;
      data["orderNo"]=this.orderNo;

    return data;
  }

  clone() {
    const json = this.toJSON();
    let result = new ChannelGroupEditDto();
    result.init(json);
    return result;
  }
}


